home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.2 Development Libraries
/
SGI IRIX 6.2 Development Libraries.iso
/
dist
/
complib.idb
/
usr
/
share
/
catman
/
p_man
/
cat3
/
complib
/
csfft2du.z
/
csfft2du
Wrap
Text File
|
1996-03-14
|
9KB
|
199 lines
ccccssssfffffffftttt2222dddduuuu,,,,zzzzddddfffffffftttt2222dddduuuu((((3333FFFF)))) ccccssssfffffffftttt2222dddduuuu,,,,zzzzddddfffffffftttt2222dddduuuu((((3333FFFF))))
NNNNAAAAMMMMEEEE
ccccssssfffffffftttt2222dddduuuu,,,, zzzzddddfffffffftttt2222dddduuuu ---- 2D, Complex-to-Real, Inverse Fast Fourier
Transforms.
SSSSYYYYNNNNOOOOPPPPSSSSYYYYSSSS
_F_o_r_t_r_a_n :
ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee ccccssssfffffffftttt2222dddduuuu(((( ssssiiiiggggnnnn,,,, nnnn1111,,,, nnnn2222,,,, aaaarrrrrrrraaaayyyy,,,, llllddddaaaa,,,, ccccooooeeeeffff ))))
iiiinnnntttteeeeggggeeeerrrr ssssiiiiggggnnnn,,,, nnnn1111,,,, nnnn2222,,,, llllddddaaaa
rrrreeeeaaaallll aaaarrrrrrrraaaayyyy((((llllddddaaaa,,,,nnnn2222)))),,,, ccccooooeeeeffff((((((((nnnn1111++++11115555))))++++2222****((((nnnn2222++++11115555))))))))
ssssuuuubbbbrrrroooouuuuttttiiiinnnneeee zzzzddddfffffffftttt2222dddduuuu(((( ssssiiiiggggnnnn,,,, nnnn1111,,,, nnnn2222,,,, aaaarrrrrrrraaaayyyy,,,, llllddddaaaa,,,, ccccooooeeeeffff ))))
iiiinnnntttteeeeggggeeeerrrr ssssiiiiggggnnnn,,,, nnnn1111,,,, nnnn2222,,,, llllddddaaaa
rrrreeeeaaaallll****8888 aaaarrrrrrrraaaayyyy((((llllddddaaaa,,,,nnnn2222)))),,,, ccccooooeeeeffff((((((((nnnn1111++++11115555))))++++2222****((((nnnn2222++++11115555))))))))
_C :
####iiiinnnncccclllluuuuddddeeee <<<<fffffffftttt....hhhh>>>>
iiiinnnntttt ccccssssfffffffftttt2222dddduuuu (((( iiiinnnntttt ssssiiiiggggnnnn,,,, iiiinnnntttt nnnn1111,,,, iiiinnnntttt nnnn2222,,,, ffffllllooooaaaatttt ****aaaarrrrrrrraaaayyyy,,,,
iiiinnnntttt llllddddaaaa,,,, ffffllllooooaaaatttt ****ccccooooeeeeffff))));;;;
iiiinnnntttt zzzzddddfffffffftttt2222dddduuuu (((( iiiinnnntttt ssssiiiiggggnnnn,,,, iiiinnnntttt nnnn1111,,,, iiiinnnntttt nnnn2222,,,, ddddoooouuuubbbblllleeee ****aaaarrrrrrrraaaayyyy,,,,
iiiinnnntttt llllddddaaaa,,,, ddddoooouuuubbbblllleeee ****ccccooooeeeeffff))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
ccccssssfffffffftttt2222dddduuuu and zzzzddddfffffffftttt2222dddduuuu compute in place the inverse Fourier transform of
real 2D sequence of size N1 x N2. The value F{k,l} of the transform of
the 2D sequence f{i,j} is equal to:
F{k,l} = Sum ( W1^(i*k) * W2^(j*l) * f{i,j} ),
for i =0,...,(N1-1), j=0,...,(n2-1)
W1 = exp( (Sign*2*sqrt(-1)*PI) / N1 )
W2 = exp( (Sign*2*sqrt(-1)*PI) / N2 )
SSSSttttoooorrrraaaaggggeeee
It is assumed that the (N1 x N2) 2D sequence is stored along dimension
N1. So the index {i+1,j} has an offset of 1 element with respect to
{i,j}, and {i,j+1} an offset of _l_d_a elements with respect to {i,j}.
NNNNOOOOTTTTEEEE :::: lda must be larger (or equal) to 2*((N1+2)/2).
AAAAllllggggoooorrrriiiitttthhhhmmmm
The complex-to-real Inverse 2D Fourier transform is computed with a row-
column approach.
- first, N1 FFTs complex-to-complex of size N2 are preformed,
stride=lda/2, and leading_dimension=1.
- then, N2 FFTs complex-to-real of size N1 are evaluated, stride = 1
and leading_dimension=lda.
As the final sequence has real values, only half of the complex Fourier
Transform is used. The sample {(N1-k),l} of the Fourier transform is the
conjugate of the sample {k,l}.
However, some extra space is necessary, and the relation
PPPPaaaaggggeeee 1111
ccccssssfffffffftttt2222dddduuuu,,,,zzzzddddfffffffftttt2222dddduuuu((((3333FFFF)))) ccccssssfffffffftttt2222dddduuuu,,,,zzzzddddfffffffftttt2222dddduuuu((((3333FFFF))))
(lda>=2*((N1+2)/2)) must hold.
PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS
SSSSIIIIGGGGNNNN Integer specifying which sign to be used for the expression of W
(see above) - must be either +1 or -1.
Unchanged on exit.
NNNN1111 Integer, the first dimension size of the 2D sequence.
Unchanged on exit.
NNNN2222 Integer, the second dimension size of the 2D sequence.
Unchanged on exit.
AAAARRRRRRRRAAAAYYYY Array containing the samples of the 2D sequence to be transformed.
On input, the element {i,j} of the sequence is stored as A(i,j) in
_F_o_r_t_r_a_n , and A[i+j*lda] in _C.
On exit, the array is overwritten by its transform.
LLLLDDDDAAAA Integer, leading dimension: increment between the samples of two
consecutive sub-sequences (e.g between {i,j+1} and {i,j} ).
Unchanged on exit.
CCCCOOOOEEEEFFFFFFFF Array of at least ( (N+15)+2*(N2+15) ) elements. On entry it
contains the Sines/Cosines and factorization of N. COEFF needs to be
initialized with a call to scfft2dui or dzfft2dui. Unchanged on
exit.
EEEExxxxaaaammmmpppplllleeee ooooffff CCCCaaaalllllllliiiinnnngggg SSSSeeeeqqqquuuueeeennnncccceeee
Direct then Inverse 2D FFT computed on a 64*1024 sequence of real values.
The elements of the sequence are stored with increment (stride) 1, and
the offset between the first element of two succesive sub-sequences
(leading dimension) is 1026.
Note : 1026 >= 1024+2 .
_F_o_r_t_r_a_n
real array(0:1026-1,0:64-1), coeff(1024+15 + 2*(64+15))
call scfft2dui( 1024, 64, coeff)
call csfft2du( -1, 1024, 64, array, 1026, coeff)
call scfft2du( 1, 1024, 64, array, 1026, coeff)
_C
#include <fft.h>
float array[64*1026], *coeff;
coeff = scfft2dui( 1024, 64, NULL);
csfft2du( -1, 1024, 64, array, 1026, coeff);
scfft2du( 1, 1024, 64, array, 1026, coeff);
NNNNOOOOTTTTEEEE____1111 :::: The Direct and Inverse transforms should use opposite signs -
Which one is used (+1 or -1) for Direct transform is just a matter of
convention-
PPPPaaaaggggeeee 2222
ccccssssfffffffftttt2222dddduuuu,,,,zzzzddddfffffffftttt2222dddduuuu((((3333FFFF)))) ccccssssfffffffftttt2222dddduuuu,,,,zzzzddddfffffffftttt2222dddduuuu((((3333FFFF))))
NNNNOOOOTTTTEEEE____2222 :::: The Fourier Transforms are not normalized so the succession
Direct-Inverse transform scales the input data by a factor equal to the
size of the transform.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
fft, scfft2dui, dzfft2dui, csfft2du, zdfft2du, scal2d, dscal2d
PPPPaaaaggggeeee 3333